home *** CD-ROM | disk | FTP | other *** search
/ Best of Shareware / Best of PC Windows Shareware 1.0 - Wayzata Technology (7111) (1993).iso / mac / WINDOWS / PRINTERS / NODEE1A / PS.CPP < prev    next >
Text File  |  1991-09-15  |  1KB  |  79 lines

  1.     #include <iostream.h>
  2.     #include <fstream.h>
  3.  
  4.     #ifndef __STRING_H
  5.         #include <string.h>
  6.     #endif
  7.  
  8.     #ifndef __DIR_H
  9.         #include <dir.h>
  10.     #endif
  11.  
  12.     #ifndef __WINDOWS_H
  13.         #include <windows.h>
  14.     #endif
  15.  
  16.  
  17.     #ifndef __PS_H
  18.         #include "ps.h"
  19.     #endif
  20.  
  21. /* Define the members of PSClean */
  22.  
  23.     int PSFile::strip(void)
  24.     {
  25.         char str[80];
  26.         int j,i;
  27.  
  28.         if (bValidFile)
  29.         {
  30.             ifstream io(szFullQFile);
  31.             if ( io )
  32.             {
  33.                 io.getline(str,80);
  34.                 io.close();
  35.                 if (strchr(str,4) != NULL);
  36.                 {
  37.                     fstream io(szFullQFile,ios::in|ios::out);
  38.                     io.seekp(0,ios::beg);
  39.  
  40.                     j=strlen(str);
  41.  
  42.                     for(i=0;i<j;i++)
  43.                         if ( str[i] != 0x4)
  44.                             io.put(str[i]);
  45.  
  46.                     io.close();
  47.  
  48.                     return 1;
  49.                 }
  50.             }
  51.         }
  52.         return 0;
  53.     }
  54.  
  55.     BOOL PSFile::test()
  56.     {
  57.         #define SZPOSTSCRIPT "%!PS"
  58.         char str[80];
  59.         BOOL i,j;
  60.  
  61.         if (bValidFile)
  62.         {
  63.             ifstream io(szFullQFile);
  64.             if ( io )
  65.             {
  66.                 io.getline(str,80);
  67.                 io.close();
  68.                 i=(strstr(str,SZPOSTSCRIPT) != (char*)NULL) ;
  69.                 j=(strchr(str,4) != (char *)NULL);
  70.                 if (i && j)
  71.                     return TRUE;
  72.             }
  73.         }
  74.         return FALSE;
  75.     }
  76.  
  77.  
  78.  
  79.